import { createRouter, createWebHashHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'

import Layout from '~/layout/index.vue'

const routes: RouteRecordRaw[] = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('~/views/login/Index.vue')
  },
  {
    path: '/init',
    name: 'Init',
    component: () => import('~/views/init/index.vue')
  },
  {
    path: '/clean',
    name: 'Clean',
    component: () => import('~/views/init/clean.vue')
  },
  {
    path: '/index',
    component: Layout,
    redirect: '/index/order',
    children: [
      {
        path: '/index/order',
        component: () => import('~/views/order/Order.vue'),
        name: 'Order'
      },
      {
        path: '/index/statics',
        component: () => import('~/views/statics/Statics.vue'),
        name: 'Statics'
      },
      {
        path: '/index/list',
        component: () => import('~/views/list/List.vue'),
        name: 'List'
      },
      {
        path: '/index/material',
        component: () => import('~/views/list/Material.vue'),
        name: 'Material'
      },
      {
        path: '/index/agents',
        component: () => import('~/views/list/Agents.vue'),
        name: 'Agents'
      }
    ]
  },
  {
    path: '/',
    redirect: '/index/order'
  }
]

export default createRouter({
  history: createWebHashHistory(),
  routes
})
